// MX610lamplighterDlg.h : header file
//

#if !defined(AFX_MX610LAMPLIGHTERDLG_H__A211A340_E71F_49FD_AC5E_665115C73348__INCLUDED_)
#define AFX_MX610LAMPLIGHTERDLG_H__A211A340_E71F_49FD_AC5E_665115C73348__INCLUDED_

#include "MXLights.h"	// Added by ClassView
#include "TrayObserver.h"	// Added by ClassView
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

/////////////////////////////////////////////////////////////////////////////
// CMX610lamplighterDlg dialog


#define MX610_CHKWNDMAX			5
#define MX610_CHKTRAYMAX		5

#define LNK_FILE_NAME "MX610LL.lnk"


#define TIMETOBECOMEGHOST 60 //sec

#define CHECKICONTIMERID		999
#define CHECKTRAYTIMERID		998
#define BECOMEGHOSTNIMERID		997

#define SGROUPMAX		2

#define	SCOUNTMAX			2



#define SHOWMX610LLWINDOW		WM_USER+999


class SS_TrayIcon;

class CMX610lamplighterDlg : public CDialog
{

public:

	class CSettings
	{
		public:
		CString wclass;
		CString wtext;
		BOOL enable;
		int value_on;
		int value_off;
		int counter;
		HICON icon;
		HWND hwnd;
		int recursionfuse;
		int maxsearchlevel;
		CStatic* info_icon;
		CStatic* info_text;
		bool isON;
		BOOL isuseswitch;
		int switchgroup;
		int switchnum;

		CSettings()
		{
			wclass="";
			wtext="";
			enable=FALSE;
			value_on=0;
			value_off=0;
			counter=0;
			icon=NULL;
			hwnd=NULL;
			info_icon=NULL;
			info_text=NULL;
			isON=false;
			isuseswitch=FALSE;
			switchgroup=0;
			switchnum=0;


		}
	};


	class CTraySettings
	{
		public:
		CString text;
		BOOL enable;
		int value_on;
		int value_off;
		int counter;
		BOOL isON;
		BOOL isuseswitch;
		int switchgroup;
		int switchnum;

		CTraySettings()
		{

			text="";
			enable=FALSE;
			value_on=0;
			value_off=0;
			counter=0;
			isON=FALSE;
			isuseswitch=FALSE;
			switchgroup=0;
			switchnum=0;

		}
	};


protected:

	int m_searchlevel;
	BOOL m_isghostmode;
	BOOL m_switch[SGROUPMAX][SCOUNTMAX];

	HICON m_noicon;
	HICON m_nowndicon;
    SS_TrayIcon* m_pTrayIcon;
	CSettings m_chkwnd[MX610_CHKWNDMAX];
	CStatic m_icon[MX610_CHKWNDMAX];
	CStatic m_text[MX610_CHKWNDMAX];
	bool m_ison[MX610_CHKWNDMAX];


	CTraySettings m_chktray[MX610_CHKTRAYMAX];

	int m_elapse;
	int m_elapsetray;
	int ReadSettings();
	void CheckWindow(CMX610lamplighterDlg::CSettings *ps);
	BOOL CheckTray(CMX610lamplighterDlg::CTraySettings *ps);
	CTrayObserver m_tray;



// Construction
public:
	CMX610Lights* m_pMX610;
	void Switch(int group, int num,BOOL val);
	BOOL IsShowReport();
	BOOL m_isfirsttime;
	CString m_inifilename;
	CMX610lamplighterDlg(CWnd* pParent = NULL);	// standard constructor
	~CMX610lamplighterDlg();
// Dialog Data
	//{{AFX_DATA(CMX610lamplighterDlg)
	enum { IDD = IDD_MX610LAMPLIGHTER_DIALOG };
	CEdit	m_trayedit;
	int		m_controlnum;
	CString	m_Version;
	//}}AFX_DATA

	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(CMX610lamplighterDlg)
	protected:
	virtual void DoDataExchange(CDataExchange* pDX);	// DDX/DDV support
	virtual LRESULT WindowProc(UINT message, WPARAM wParam, LPARAM lParam);
	virtual BOOL OnCommand(WPARAM wParam, LPARAM lParam);
	//}}AFX_VIRTUAL

// Implementation
protected:
	void GoToGhostMode(BOOL isAskUser);


	HICON m_hIcon;

	// Generated message map functions
	//{{AFX_MSG(CMX610lamplighterDlg)
	virtual BOOL OnInitDialog();
	afx_msg void OnPaint();
	afx_msg HCURSOR OnQueryDragIcon();
	afx_msg void OnTimer(UINT nIDEvent);
	afx_msg void OnButtonHide();
	afx_msg void OnButtonExit();
	afx_msg void OnButtonGo();
	afx_msg void OnButtonSAdd();
	afx_msg void OnButtonSDel();
	afx_msg void OnButtonINI();
	afx_msg void OnButtonGhost();
	afx_msg LRESULT OnPowerBroadcast(WPARAM wParam, LPARAM lParam); 
	//}}AFX_MSG
	DECLARE_MESSAGE_MAP()
private:
	CString GetVersionString();
	CString m_WindowTitle;
};

//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.

#endif // !defined(AFX_MX610LAMPLIGHTERDLG_H__A211A340_E71F_49FD_AC5E_665115C73348__INCLUDED_)
